package com.sjq.common.util;

import java.io.Serializable;
import java.util.List;

public class PageResults<T> implements Serializable {

	private static final long serialVersionUID = 6038448585602694737L;

	// 每页显示10条记录
	public static final Integer ALLPAGESIZE = 10;
	// 当前页的页数
	private int pageNo;

	// 每页记录数
	private int pageSize;

	// 一共多少条数据
	private int totalCount;

	// 一共多少页
	private int pageCount;

	// 查出的结果集
	private List<T> results;

	public int getPageCount() {
		return pageCount = totalCount % pageSize == 0 ? totalCount
				/ pageSize : totalCount / pageSize + 1;
	}

	public void setPageCount(int pageCount) {
		this.pageCount = pageCount;
	}

	public int getPageNo() {
		return pageNo;
	}

	public void setPageNo(int pageNo) {
		this.pageNo = pageNo;
	}

	public List<T> getResults() {
		return results;
		
	}

	public void setResults(List<T> results) {
		this.results = results;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}

	@Override
	public String toString() {
		return "PageResults [pageNo=" + pageNo + ", totalCount=" + totalCount
				+ ", pageCount=" + pageCount + ", results=" + results + "]";
	}

}
